POV-Ray : Newsgroups : povray.text.scene-files : Refraction bug(?) this time : Re: Refraction bug(?) this time Server Time
29 Jul 2024 06:15:37 EDT (-0400)
  Re: Refraction bug(?) this time  
From: Nieminen Mika
Date: 4 Dec 1998 08:55:11
Message: <3667e9bf.0@news.povray.org>
=Bob <ver### [at] aolcom> wrote:
: I understood the nature of them already, that they have inside and outside. 
: Guess that's why this caught my attention so much, if other shapes in csg (or 
: not, remember my example uses none) did this it would be a disaster since many 
: csg-created objects use an inverse to get the right construction.
: A plane *is* capable of csg too, as many may know, by keeping the 
: inside/outside in mind, same goes for all the other primitives capable of csg.

  I think you haven't completely understood the plane object.
  You say: "if other shapes in csg did this it would be a disaster". Actually
all other shapes DO this. Just put a box or a sphere or whatever in the
place of the plane and make it inverse. You will get the same effect.

  Most of the objects have well defined inside and outside. Everything that
is inside the surface of a sphere, is the inside of the sphere, and
everything else is outside (this may sound very trivial, but it's important
to understans). Everything that is below the surface of a plane is the
inside of the plane, and everything else is outside.
  Now, when you apply the 'inverse' keyword, this is changed: Everything
that is inside the sphere surface becomes outside, and everything outside
the sphere surface is now inside. When you make an 'inverse' plane,
everything that is below the plane becomes outside, and everything else
is inside.
  Now, suppose you have a plane and a sphere:

plane { y,-10 }
sphere { 0,1 }

  The sphere is outside the plane because it's above the plane (the plane
normal points upwards and it's located 10 units in the negative y direction).
  If we make this:

plane { y,-10 inverse }
sphere { 0,1 }

now the sphere is _inside_ the plane, because now everything above the plane
is inside it and everything below the plane is outside it.
  This works with other primitives too:

sphere { -y*10,1 }
sphere { 0,1 }

  The second sphere is outside the first sphere, but:

sphere { -y*10,1 inverse }
sphere { 0,1 }

now the second sphere is _inside_ the first sphere. The interior of the
first sphere has became the outside part of it. This may sound confusing,
I know...

  You also don't seem to know how 'inverse' works in CSG. Well, let's see:
  Suppose we have this:

intersection
{ sphere { 0,2 }
  sphere { 0,1 inverse }
}

  Intersection means that a point is inside it if it's inside all the objects
in the intersection.
  A point can be inside the first sphere only if it's at a distance less than
2 from the origin. A point can be inside the second sphere only of it's at
a distance _greater_ than 1 from the origin (because the second sphere is
inversed). So a point is inside this intersection only if it's at a distance
less than 2 and greater than 1 from the origin.
  This means that a point that is, for example, at a distance of 3 from the
origin is outside the intersection, and thus will not be affected by the
interior of it.
  If you don't believe this, you can try it with the "problematic" primivite,
the plane. For example:

intersection
{ sphere { 0,2 }
  plane { y,0 inverse }
}

  A point is inside this intersection if it's inside the sphere and above
the plane (because the plane is inversed). This means that a point can
be inside the intersection only if it's at a distance less than 2 from
the origin and also in the positive y direction.
  So a point that is, for example, 3 units above the plane is not inside the
intersection and it will not be affected by its interior.

  So there's nothing problematic about the plane.
  There's absolutely no difference between a sphere, a box or a plane when
we are talking about CSG or inside and outside. The only difference is
that the plane is infinite, but that's just a mathematical detail, and
we shouldn't get confused by such little peculiarity.

-- 
main(i){char*_="BdsyFBThhHFBThhHFRz]NFTITQF|DJIFHQhhF";while(i=
*_++)for(;i>1;printf("%s",i-70?i&1?"[]":" ":(i=0,"\n")),i/=2);} /*- Warp. -*/


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.